//
// Created by iguilty on 2022-01-14.
//

#ifndef DESIGN_PATTERN_CPP_MEMENTO_H
#define DESIGN_PATTERN_CPP_MEMENTO_H

#include <string>
using namespace std;

class Memento;
class Originator{
public:
    typedef string State;
    Originator();
    Originator(const State& sdt);
    ~Originator();
    Memento* CreateMemento();
    void SetMemento(Memento* memento);
    void RestoreToMemento(Memento *memento);
    State GetState();
    void SetState(const State& sdt);
    void PrintState();
private:
    State _sdt;
    Memento* _mt;
};

class Memento{
private:
    friend class Originator;
    typedef string State;
    Memento();
    Memento(const State& sdt);
    ~Memento();
    void SetState(const State& sdt);
    State GetState();
    State _sdt;
};

#endif //DESIGN_PATTERN_CPP_MEMENTO_H
